﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Documents;
using DTC.Database;

namespace DTC.Converters
{
    //[ValueConversion(typeof(List<DTCOrderedBox>), typeof(string))]
    public class BoxCountConverter : IValueConverter
    {

        public int DrugId { get; set; }
        public object Convert(object value, Type targetType, object parameter,
           CultureInfo culture)
        {
            var boxes = value as List<DTCOrderedBox>;
            if(boxes == null)
                return null;
            var res = boxes.Where(b=>b.DTCBox.DTCDrugUnit.DTCDrug.DrugID == DrugId);
            return res;
        }
        public object ConvertBack(object value, Type targetType, object parameter,
            CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
